<?php 
			
?>
<a class='btn  btn-info' href="<?php echo SERVER_PATH.clients.html ?>"><?php echo translate_word_shop('back_to_wishlist',$dictionary_app); ?></a>
<table id="whislist_products_table" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>	
			<th><?php  echo translate_word_shop('add_date',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('product_name',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('visible_product',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('wishmeter',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('email_status',$dictionary_app); ?></th>			
			<th><?php  echo translate_word_shop('Actions',$dictionary_app); ?></th>
		</tr>
	</thead>
	<tbody>
		<?php
			$params= array($_GET['client']);
			$results =$shopObj->fetch_result("SELECT * FROM clients_wishlists WHERE client_id =?",$params);
			foreach($results as $key=>$value){
				$params = array($value['product_id'],$available_lang[0]['id']);
						
				$product= $shopObj->fetch_one("SELECT products_details.name,products.visible,products.id FROM products_details,products
													 WHERE products_details.product_id=products.id AND products_details.product_id=? AND language_id=?",$params);
				if($product['visible']==1){
					$visible = translate_word_shop('yes',$dictionary_app);
				}else{
					$visible = translate_word_shop('no',$dictionary_app);
				}		
				if($value['email_status']==0){
					$email_sts = translate_word_shop('email_not_sent');
				}else{
					$email_sts = translate_word_shop('email_sent');
				}
				echo "<tr>
						<td>".date('d/m/Y', $results['date'])."</td>
						<td>{$product['name']}</td>
						<td>{$visible}</td>
						<td>";

							for($i=0;$i<5;$i++){
								echo "<div style='width:10px;height:10px;border:1px solid #FF0000;float:left;margin-right:5px;";
								if($i<$value['wishmeter']){ echo " background-color:#FF0000 ";}
								echo "'></div>";
							}

				echo	"</td>
						<td>{$email_sts}</td>

						<td>
							<button class='btn btn-mini btn-success' href='javascript:void(0)' onclick='edit_discount({$value['client_id']},{$product['id']})'>
								<i class='icon-pencil bigger-130'></i>
								view discounts
							</button>
						</td>
					  </tr>";
			}
		?>
	</tbody>
</table>
<div id="modal-clients-data" class="modal hide fade"  tabindex="-1">
	<div class="modal-header no-padding">
		<div class="table-header">
			<button type="button" class="close" data-dismiss="modal">&times;</button>
			<?php  echo translate_word_shop('Add discount',$dictionary_app); ?>

		</div>
	</div>

	<form id='discount_form' class='span12'>
		<div class="control-group ">
			<label class="control-label span3" for="discount_type"><?php  echo translate_word_shop('discount_type',$dictionary_app); ?></label>
			<div class="controls span9">

				<select id='type' name='discount_type' class='span7'>
					<option value='0'>%</option>
					<option value='1'><?php echo translate_word_shop('money',$dictionary_app); ?></option>
				</select>	
			</div>
		</div>
		<div class="control-group ">
			<label class="control-label span3" for="discount"><?php  echo translate_word_shop('discount',$dictionary_app); ?></label>
			<div class="controls span9">
				<input id="discount" name='discount' class='span7' type="text"  >
			</div>
		</div>
		<div class="control-group ">
			<label class="control-label span3" for="coupon_code"><?php  echo translate_word_shop('cupon_code',$dictionary_app); ?></label>
			<div class="controls span9">
				<input id="coupon_code" name='coupon_code' class='span7' type="text"  >
			</div>
		</div>
		<div class="control-group ">
			<label class="control-label span3" for="end"><?php  echo translate_word_shop('expiration_date',$dictionary_app); ?></label>
			<div class="controls span9">
				<input id="end" name='expiration_date' class='span7' type="text"  >
			</div>
		</div>
		<div class="control-group ">
			<label class="control-label span3" for=""><?php  echo translate_word_shop('used',$dictionary_app); ?></label>
			<div class="controls span9" id='active'>
				
			</div>
		</div>
		<br class='clear'/>
		<div class="control-group ">
			<label class="control-label span3" for="mail_message"><?php  echo translate_word_shop('mail_message',$dictionary_app); ?></label>
			<div class="controls span9" >
				<textarea id='mail_message' name='mail_message' class='span7'></textarea>
			</div>
		</div>
		<br class='clear'/>
	</form>
	<br class='clear'/>
	<div class="modal-footer ">
		<button class="btn btn-small btn-primary" data-dismiss="modal" onclick='save_discount();' ><?php  echo translate_word_shop('send_mail',$dictionary_app); ?></button>
		<button class="btn btn-small btn-danger btn-primary" data-dismiss="modal"><?php  echo translate_word_shop('cancel',$dictionary_app); ?></button>
	</div>
</div>	